@extends('develop.layoutEdit')

@section('css')
    <style>
        .layer-go-back{
            display:none;
        }
    </style>
@endsection

@section('title')
    <li class="cur">
        <span>用户注册协议</span>
    </li>
@endsection

@section('content')

    <input type="hidden" name="function_id" id="function_id" value="{{ $function_id or ''}}">
    <div class="form-group">
        <textarea name="register" id="register" style="visibility:hidden;height: 399px;width: 100%;">{{$configure['register'] or ''}}</textarea>
    </div>

    <div class="form-group" style="margin-bottom: 0px !important;">
        <input type="button"  value="保存" onclick="customer.save();" class="btn btn-success" >
    </div>

@endsection

@section('js')
    <link rel="stylesheet" href="/framework/kindeditor/themes/default/default.css?v=20140227" type="text/css" media="screen" />
    <script src="/framework/kindeditor/kindeditor-all.js?v=201704051935" type="text/javascript"></script>
    <script src="/framework/kindeditor/lang/zh_CN.js" type="text/javascript"></script>
<script>

    window.editor = KindEditor.create("#register");

    var customer = {

        function_id : {{ $function_id or ''}},


        save:function(){

            editor.sync();

            var configure = { };

            configure.function_id = $('#function_id').val();
            configure.register = $('#register').val();

            var index  = layer.load() ;
            E.ajax( {
                type:'post',
                url: '/lar/develop/function/store/'+customer.function_id,
                data:configure,
                dataType:'json',
                // 返回值判断
                success: function ( obj ){
                    layer.close( index) ;
                    if ( obj.code == 200 ) {
                        layer.alert( obj.message , { icon: 1,time : 1500 } ) ;
                    } else {
                        layer.alert( obj.message , { icon: 2 } ) ;
                    }
                }
            });

        }
    };

</script>

@endsection